package com.example.freeengine.filetranslate.persistence.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Terry Deng
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity(tableName = "file_translate_download_file")
public class FileTranslateDownloadFile {

    @PrimaryKey(autoGenerate = true)
    public Long id;

    @ColumnInfo(name = "name")
    public String name;

    @ColumnInfo(name = "file_path")
    public String filePath;

    /**
     * bytes
     */
    @ColumnInfo(name = "size")
    public Integer size;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FileTranslateDownloadFile that = (FileTranslateDownloadFile) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(name, that.name) &&
                Objects.equals(size, that.size);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, size);
    }
}
